#!/usr/bin/env python

from os.path import dirname, join
import sys
import cmdln


@cmdln.option("-v", "--verbose", dest="verbose",
              action="store_true", default=False)
class Client(cmdln.CmdlnWithConfigParser):
    name = "cfgexample"

    def postoptparse(self):
        print '[DEBUG] Global options:', self.options

    @cmdln.option("-i", dest="inputfile")
    def do_dosomething(self, subcmd, opts, *paths):
        """Open a new file to add it to the depot
        
        usage:
            p4 add [PATHS...]

        ${cmd_option_list}
        """
        print("verbose? %s" % self.options.verbose)
        print("inputfile = %s" % opts.inputfile)


if __name__ == '__main__':
    client = Client(default_configfile=join(
        dirname(__file__), 'cfgexample.conf'))
    sys.exit(client.main(sys.argv))
